Sesión 02

Diseño Completamente al Azar


Christian Vásquez-Velasco, Bach., M.Sc.(c)

InkaStats Academy

2023

Planeamiento


Instalar paquetes necesarios


# install.packages("devtools")
# devtools::install_github("emitanaka/edibble", force = T)
# devtools::install_github("emitanaka/deggust", force = T)

if (!require("pacman")) install.packages("pacman")
pacman::p_load(readxl, agricolae, agricolaeplotr, car, tidyverse, PMCMRplus, outliers, nortest, mvtnorm, lmtest, ExpDes, edibble, gt,
               gtsummary, devtools, deggust, xlsx, desplot,
               ggResidpanel, fastGraph)

Crear un libro de campo con el paquete agricolae


variedades <- c("Amazon", "Coari x Lame", "Coari x Yangambí",
                "Unipalma")

r <- 20

salida <- agricolae::design.crd(trt = variedades,
                                r = r,
                                serie = 2,
                                seed = 123,
                                kinds = "Super-Duper",
                                randomization = TRUE)
salida$book %>% 
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)

Guardar el libro generado

write.table(salida$book, "books/crd.txt",
            row.names = FALSE, sep = "\t")

write.xlsx(salida$book, "books/crd.xlsx", sheetName = "book", append = FALSE, row.names = FALSE)
agricolaeplotr::plot_design_crd(design = salida,
                                factor_name = "variedades",
                                ncols = 4,
                                nrows = 20,
                                reverse_y = TRUE) +
  labs(fill = "Variedades",
       x = "Columnas",
       y = "Filas")

Crear un libro de campo con el paquete edibble


menu_crd()
design("Completely Randomised Design") %>%
  set_units(unit = 22) %>%
  set_trts(trt = 3) %>%
  allot_trts(trt ~ unit) %>%
  assign_trts("random", seed = 896) %>%
  serve_table()
crd <- takeout(menu_crd(t = 4, n = r*4, seed = 123))
crd %>% 
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)
crd2 <- design("Completely Randomised Design") %>%
  set_units(unit = 80) %>%
  set_trts(variedades = c("Amazon", "Coari x Lame", "Coari x Yangambí", "Unipalma")) %>%
  allot_trts(variedades ~ unit) %>%
  assign_trts("random", seed = 123) %>%
  serve_table()
crd2 %>% 
  gt::gt() %>%
  gt::opt_interactive(use_search = TRUE,
                      use_filters = TRUE,
                      use_compact_mode = TRUE,
                      page_size_default = 5)
# deggust::autoplot(crd)

Análisis del diseño


Importación de datos


Creación del modelo lineal


modelo.dca <- lm(rdt ~ trt, data = data)
ggplot(data,
       aes(x = trt,
           y = rdt)) +
  geom_jitter(width = 0.2) +
  geom_point(data = data %>%
               group_by(trt) %>%
               summarise(mean_rdt = mean(rdt)) %>%
               ungroup(),
             aes(x = trt, y = mean_rdt),
             fill = "red",
             shape = 21,
             size = 3,
             alpha = 0.5)

Definición del modelo


\[Y = \beta_0 + \beta_1*trt_B + \beta_2*trt_C + \beta_3*trt_D + \beta_4*trt_E + \epsilon\]

\[\hat{Y} = \beta_0 + \beta_1*trt_B + \beta_2*trt_C + \beta_3*trt_D + \beta_4*trt_E\]

summary(modelo.dca)

Call:
lm(formula = rdt ~ trt, data = data)

Residuals:
   Min     1Q Median     3Q    Max 
-7.308 -1.578  0.282  1.576  5.592 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   47.134      1.394  33.813  < 2e-16 ***
trtB           4.584      1.971   2.325 0.030693 *  
trtC           8.594      1.971   4.359 0.000304 ***
trtD          12.034      1.971   6.104 5.76e-06 ***
trtE          11.744      1.971   5.957 7.96e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.117 on 20 degrees of freedom
Multiple R-squared:  0.7288,    Adjusted R-squared:  0.6746 
F-statistic: 13.44 on 4 and 20 DF,  p-value: 1.781e-05

Verificación visual de los supuestos del modelo


performance::check_model(modelo.dca)
ggResidpanel::resid_panel(modelo.dca)
influence.measures(modelo.dca)
Influence measures of
     lm(formula = rdt ~ trt, data = data) :

      dfb.1_  dfb.trtB  dfb.trtC  dfb.trtD  dfb.trtE   dffit cov.r   cook.d hat
1  -2.29e-17  1.62e-17  7.48e-18  3.77e-17  7.08e-02  0.1001 1.599 0.002105 0.2
2   6.34e-17 -6.83e-17 -7.03e-02 -2.69e-17 -4.32e-17 -0.0994 1.599 0.002075 0.2
3  -1.31e-16 -1.11e+00  3.62e-16  1.32e-16 -2.45e-16 -1.5767 0.197 0.343558 0.2
4  -9.26e-01  6.55e-01  6.55e-01  6.55e-01  6.55e-01 -0.9256 0.705 0.152818 0.2
5  -8.87e-17  5.68e-17  1.08e-16  2.15e-01  2.36e-17  0.3039 1.467 0.019075 0.2
6   2.55e-02 -1.80e-02 -1.80e-02 -1.80e-02 -1.80e-02  0.0255 1.614 0.000137 0.2
7  -9.93e-17  6.42e-17  1.08e-16  2.15e-01  4.24e-17  0.3039 1.467 0.019075 0.2
8  -9.87e-18 -3.49e-17 -2.51e-01  4.78e-18  0.00e+00 -0.3556 1.417 0.025938 0.2
9  -2.32e-17 -1.97e-01  5.26e-17 -1.12e-17  0.00e+00 -0.2781 1.490 0.016018 0.2
10 -4.33e-18  3.06e-18  6.87e-18  5.38e-18  7.08e-02  0.1001 1.599 0.002105 0.2
11 -6.28e-18 -2.22e-17 -1.60e-01  3.04e-18  0.00e+00 -0.2264 1.531 0.010672 0.2
12  7.70e-17  6.54e-01 -1.75e-16  3.73e-17  0.00e+00  0.9252 0.706 0.152693 0.2
13  1.95e-16 -1.26e-16 -2.12e-16 -4.23e-01 -8.35e-17 -0.5978 1.124 0.069969 0.2
14  2.34e-17 -1.66e-17 -3.72e-17 -2.91e-17 -3.83e-01 -0.5418 1.197 0.058205 0.2
15  4.08e-01 -2.89e-01 -2.89e-01 -2.89e-01 -2.89e-01  0.4083 1.359 0.033911 0.2
16 -2.32e-17 -1.97e-01  5.26e-17 -1.12e-17  0.00e+00 -0.2781 1.490 0.016018 0.2
17 -9.82e-18  6.94e-18  1.56e-17  1.22e-17  1.61e-01  0.2271 1.531 0.010738 0.2
18  1.50e-01 -1.06e-01 -1.06e-01 -1.06e-01 -1.06e-01  0.1500 1.578 0.004714 0.2
19  2.45e-17 -1.58e-17 -2.66e-17 -5.29e-02 -1.05e-17 -0.0749 1.606 0.001178 0.2
20  1.89e-17  6.69e-17  4.82e-01 -9.16e-18  0.00e+00  0.6817 1.013 0.089116 0.2
21 -1.61e-17  1.04e-17  1.75e-17  3.49e-02  6.89e-18  0.0493 1.611 0.000512 0.2
22  2.78e-01 -1.96e-01 -1.96e-01 -1.96e-01 -1.96e-01  0.2777 1.490 0.015978 0.2
23 -4.33e-18  3.06e-18  6.87e-18  5.38e-18  7.08e-02  0.1001 1.599 0.002105 0.2
24  6.89e-19  2.44e-18  1.76e-02 -3.34e-19  0.00e+00  0.0248 1.614 0.000130 0.2
25  9.11e-17  7.73e-01 -2.07e-16  4.41e-17  0.00e+00  1.0937 0.526 0.201158 0.2
   inf
1     
2     
3    *
4     
5     
6     
7     
8     
9     
10    
11    
12    
13    
14    
15    
16    
17    
18    
19    
20    
21    
22    
23    
24    
25    
influenceIndexPlot(modelo.dca)

Cumplimiento de supuestos del modelo lineal general


Independencia de residuos

\(H_0: \text{Los residuos del rendimiento son completamente aleatorios e independientes}\)

\(H_1: \text{Los residuos del rendimiento no son completamente aleatorios e independientes}\)

durbinWatsonTest(modelo.dca,
                 reps = 5000,
                 max.lag = 5)
 lag Autocorrelation D-W Statistic p-value
   1      0.03629698     1.7647958  0.6836
   2     -0.05525749     1.9461407  0.8992
   3      0.05897337     1.4411487  0.3020
   4     -0.17399282     1.7720445  0.9476
   5      0.41947561     0.5694382  0.0028
 Alternative hypothesis: rho[lag] != 0
dwtest(modelo.dca, alternative = "two.sided")

    Durbin-Watson test

data:  modelo.dca
DW = 1.7648, p-value = 0.7037
alternative hypothesis: true autocorrelation is not 0

Conclusión. A un nivel de significancia de 0.1, se concluye que no existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, los residuos del rendimiento son completamente aleatorios e independientes.

Normalidad de residuos

\(H_0: \text{La distribución de los residuos del rendimiento es similar a la función normal}\)

\(H_1: \text{La distribución de los residuos del rendimiento es similar a la función normal}\)

shapiro.test(rstudent(modelo.dca))

    Shapiro-Wilk normality test

data:  rstudent(modelo.dca)
W = 0.94978, p-value = 0.2479
ad.test(rstudent(modelo.dca))

    Anderson-Darling normality test

data:  rstudent(modelo.dca)
A = 0.51954, p-value = 0.169
lillie.test(rstudent(modelo.dca))

    Lilliefors (Kolmogorov-Smirnov) normality test

data:  rstudent(modelo.dca)
D = 0.12748, p-value = 0.3684
ks.test(rstudent(modelo.dca), "pnorm",
        alternative = "two.sided")

    Asymptotic one-sample Kolmogorov-Smirnov test

data:  rstudent(modelo.dca)
D = 0.1198, p-value = 0.8656
alternative hypothesis: two-sided
cvm.test(rstudent(modelo.dca))

    Cramer-von Mises normality test

data:  rstudent(modelo.dca)
W = 0.090314, p-value = 0.1445
pearson.test(rstudent(modelo.dca))

    Pearson chi-square normality test

data:  rstudent(modelo.dca)
P = 7.96, p-value = 0.1585
sf.test(rstudent(modelo.dca))

    Shapiro-Francia normality test

data:  rstudent(modelo.dca)
W = 0.93585, p-value = 0.108

Conclusión. A un nivel de significancia de 0.1, se concluye que no existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, la distribución de los residuos del rendimiento es similar a la función normal o gaussiana.

Igualdad de varianzas

data <- data %>%
  mutate(residuals = residuals(modelo.dca),
         rstudent = rstudent(modelo.dca))
ggplot(data,
       aes(x = trt,
           y = rstudent)) +
  geom_jitter(width = 0.2) +
  geom_point(data = data %>%
               group_by(trt) %>%
               summarise(mean_res = mean(rstudent)) %>%
               ungroup(),
             aes(x = trt, y = mean_res),
             fill = "red",
             shape = 21,
             size = 3,
             alpha = 0.5)
data %>%
  group_by(trt) %>%
  summarise(varianza = sum(residuals^2)/(n()-1)) %>%
  ungroup()
# A tibble: 5 × 2
  trt   varianza
  <fct>    <dbl>
1 A         8.07
2 B        28.3 
3 C         4.97
4 D         4.27
5 E         2.92

\(H_0: \sigma_{Trt_A} = \sigma_{Trt_B} = \sigma_{Trt_C} = \sigma_{Trt_D} = \sigma_{Trt_E}\)

\(H_1: \text{Al menos en al menos un tratamiento la } \sigma \text{ del rendimiento es diferente a los demás}\)

cochran.test(rdt ~ trt, data = data)

    Cochran test for outlying variance

data:  rdt ~ trt
C = 0.58356, df = 5, k = 5, p-value = 0.02564
alternative hypothesis: Group B has outlying variance
sample estimates:
       A        B        C        D        E 
 8.06633 28.34847  4.97177  4.26752  2.92472 
cochranTest(rdt ~ trt, data = data)

    Cochran test for outlying variance

data:  rdt by trt
C = 0.58356, k = 5, n = 5, p-value = 0.02564
alternative hypothesis: greater
sample estimates:
   group      var 
 2.00000 28.34847 
hartleyTest(rdt ~ trt, data = data)

    Hartley's maximum F-ratio test of homogeneity of variances

data:  rdt by trt
F Max = 9.6927, df = 4, k = 5, p-value = 0.2493
bartlett.test(rdt ~ trt, data = data)

    Bartlett test of homogeneity of variances

data:  rdt by trt
Bartlett's K-squared = 6.5762, df = 4, p-value = 0.16
leveneTest(rdt ~ trt, data = data)
Levene's Test for Homogeneity of Variance (center = median)
      Df F value Pr(>F)
group  4  1.3538 0.2851
      20               
leveneTest(rdt ~ trt, data = data, center = "mean")
Levene's Test for Homogeneity of Variance (center = "mean")
      Df F value Pr(>F)  
group  4  2.5479 0.0712 .
      20                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fligner.test(rdt ~ trt, data = data)

    Fligner-Killeen test of homogeneity of variances

data:  rdt by trt
Fligner-Killeen:med chi-squared = 3.8461, df = 4, p-value = 0.4272

Homocedasticidad

\(H_0: \text{La varianza del rendimiento es constante con respecto a los valores ajustados del rendimiento}\)

\(H_1: \text{La varianza del rendimiento no es constante con respecto a los valores ajustados del rendimiento}\)

ncvTest(modelo.dca)
Non-constant Variance Score Test 
Variance formula: ~ fitted.values 
Chisquare = 2.569732, Df = 1, p = 0.10893
bptest(modelo.dca)

    studentized Breusch-Pagan test

data:  modelo.dca
BP = 9.1322, df = 4, p-value = 0.05788
bptest(modelo.dca, studentize = F)

    Breusch-Pagan test

data:  modelo.dca
BP = 11.87, df = 4, p-value = 0.01834
olsrr::ols_test_breusch_pagan(modelo.dca)

 Breusch Pagan Test for Heteroskedasticity
 -----------------------------------------
 Ho: the variance is constant            
 Ha: the variance is not constant        

             Data               
 -------------------------------
 Response : rdt 
 Variables: fitted values of rdt 

        Test Summary         
 ----------------------------
 DF            =    1 
 Chi2          =    2.569732 
 Prob > Chi2   =    0.1089262 

Conclusión. A un nivel de significancia de 0.1, se concluye que existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, la varianza del rendimiento no es constante con respecto a los valores ajustados del rendimiento.

Recomendación. Debido a que no se cumple con el supuesto de homocedasticidad, para evaluar los efectos de los tratamientos con respecto al rendimiento, se debería utilizar pruebas no paramétricas o modelos lineales generalizados a fin cumplir con los supuestos requeridos por las pruebas.

Análisis de varianza

\[Y = \mu + \tau_{i} + \epsilon\]

\[\hat{Y} = \mu + \tau_{i}\]

\(H_0: \tau_{A} = \tau_{B} = \tau_{C} = \tau_{D} = \tau_{E} = 0\)

\(H_1: \text{En al menos un tratamiento el } \tau \text{ es diferente a los demás.}\)

\(H_1: \tau_i \neq 0\text{; en al menos un tratamiento.}\)

anova(modelo.dca, test = "F")
Analysis of Variance Table

Response: rdt
          Df Sum Sq Mean Sq F value    Pr(>F)    
trt        4 522.30 130.574  13.439 1.781e-05 ***
Residuals 20 194.32   9.716                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
qf(0.95, 4, 20)
[1] 2.866081
shadeDist(qf(0.95, 4, 20), "df",4, 20, lower.tail = F)

Conclusión. A un nivel de significancia de 0.05, se concluye que existe suficiente evidencia estadística para rechazar la hipótesis nula, por lo tanto, al menos un tratamiento tiene un efecto sobre el rendimiento estadísticamente diferente del resto de tratamientos.

Comparaciones de medias

  • A vs B:

\(H_0: \mu_{A} - \mu_{B} = 0\)

\(H_1: \mu_{A} - \mu_{B} \neq 0\)

  • A vs C:

\(H_0: \mu_{A} - \mu_{C} = 0\)

\(H_1: \mu_{A} - \mu_{C} \neq 0\)

  • A vs D:

\(H_0: \mu_{A} - \mu_{D} = 0\)

\(H_1: \mu_{A} - \mu_{D} \neq 0\)

  • A vs E:

\(H_0: \mu_{A} - \mu_{E} = 0\)

\(H_1: \mu_{A} - \mu_{E} \neq 0\)

  • B vs C:

\(H_0: \mu_{B} - \mu_{C} = 0\)

\(H_1: \mu_{B} - \mu_{C} \neq 0\)

  • B vs D:

\(H_0: \mu_{B} - \mu_{D} = 0\)

\(H_1: \mu_{B} - \mu_{D} \neq 0\)

  • B vs E:

\(H_0: \mu_{B} - \mu_{E} = 0\)

\(H_1: \mu_{B} - \mu_{E} \neq 0\)

  • C vs D:

\(H_0: \mu_{C} - \mu_{D} = 0\)

\(H_1: \mu_{C} - \mu_{D} \neq 0\)

  • C vs E:

\(H_0: \mu_{C} - \mu_{E} = 0\)

\(H_1: \mu_{C} - \mu_{E} \neq 0\)

  • D vs E:

\(H_0: \mu_{D} - \mu_{E} = 0\)

\(H_1: \mu_{D} - \mu_{E} \neq 0\)

Prueba de HSD (Honestamente significativa -> Tukey)

agricolae::HSD.test(modelo.dca, trt = "trt", alpha = 0.05,
         group = TRUE, main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

HSD Test for rdt 

Mean Square Error:  9.715762 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 20 
Critical Value of Studentized Range: 4.231857 

Minimun Significant Difference: 5.899081 

Treatments with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878      a
C 55.728     ab
B 51.718     bc
A 47.134      c
agricolae::HSD.test(modelo.dca, trt = "trt", alpha = 0.05,
         group = FALSE, main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

HSD Test for rdt 

Mean Square Error:  9.715762 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 20 
Critical Value of Studentized Range: 4.231857 

Comparison between treatments means

      difference pvalue signif.        LCL       UCL
A - B     -4.584 0.1780         -10.483081  1.315081
A - C     -8.594 0.0025      ** -14.493081 -2.694919
A - D    -12.034 0.0001     *** -17.933081 -6.134919
A - E    -11.744 0.0001     *** -17.643081 -5.844919
B - C     -4.010 0.2864          -9.909081  1.889081
B - D     -7.450 0.0092      ** -13.349081 -1.550919
B - E     -7.160 0.0128       * -13.059081 -1.260919
C - D     -3.440 0.4308          -9.339081  2.459081
C - E     -3.150 0.5155          -9.049081  2.749081
D - E      0.290 0.9999          -5.609081  6.189081

Nota: Todos aquellos tratamientos que compartan por lo menos una letra serán estadísticamente similares.

Recomendación: Se debe usar la prueba de Tukey cuando como máximo se tenga 6 tratamientos.

Prueba de Duncan

agricolae::duncan.test(modelo.dca, trt = "trt", 
                       alpha = 0.05, group = TRUE, 
                       main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

Duncan's new multiple range test
for rdt 

Mean Square Error:  9.715762 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 20 

Critical Range
       2        3        4        5 
4.112208 4.316437 4.446229 4.536881 

Means with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878      a
C 55.728     ab
B 51.718      b
A 47.134      c
agricolae::duncan.test(modelo.dca, trt = "trt", 
                       alpha = 0.05, group = FALSE, 
                       main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

Duncan's new multiple range test
for rdt 

Mean Square Error:  9.715762 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Comparison between treatments means

      difference pvalue signif.        LCL        UCL
A - B     -4.584 0.0307       *  -8.696208 -0.4717917
A - C     -8.594 0.0004     *** -12.910437 -4.2775629
A - D    -12.034 0.0000     *** -16.570881 -7.4971186
A - E    -11.744 0.0000     *** -16.190229 -7.2977710
B - C     -4.010 0.0554       .  -8.122208  0.1022083
B - D     -7.450 0.0020      ** -11.896229 -3.0037710
B - E     -7.160 0.0023      ** -11.476437 -2.8435629
C - D     -3.440 0.1132          -7.756437  0.8764371
C - E     -3.150 0.1258          -7.262208  0.9622083
D - E      0.290 0.8845          -3.822208  4.4022083

Nota: La prueba de Duncan usa múltiples valores críticos.

Recomendación: No usar la prueba de Duncan cuando se presentan resultados con múltiples tratamientos que obtengan varias significancias.

Prueba de Student - Newman -Keuls

agricolae::SNK.test(modelo.dca, trt = "trt", 
                       alpha = 0.05, group = TRUE, 
                       main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

Student Newman Keuls Test
for rdt 

Mean Square Error:  9.715762 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Alpha: 0.05 ; DF Error: 20 

Critical Range
       2        3        4        5 
4.112208 4.987534 5.517742 5.899081 

Means with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878      a
C 55.728     ab
B 51.718      b
A 47.134      c
agricolae::SNK.test(modelo.dca, trt = "trt", 
                       alpha = 0.05, group = FALSE, 
                       main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

Student Newman Keuls Test
for rdt 

Mean Square Error:  9.715762 

trt,  means

     rdt      std r   Min   Max
A 47.134 2.840129 5 42.26 49.43
B 51.718 5.324328 5 44.41 57.31
C 55.728 2.229747 5 53.72 59.45
D 59.168 2.065798 5 55.87 60.89
E 58.878 1.710181 5 55.87 60.17

Comparison between treatments means

      difference pvalue signif.        LCL        UCL
A - B     -4.584 0.0307       *  -8.696208 -0.4717917
A - C     -8.594 0.0008     *** -13.581534 -3.6064665
A - D    -12.034 0.0001     *** -17.933081 -6.1349187
A - E    -11.744 0.0000     *** -17.261742 -6.2262576
B - C     -4.010 0.0554       .  -8.122208  0.1022083
B - D     -7.450 0.0060      ** -12.967742 -1.9322576
B - E     -7.160 0.0045      ** -12.147534 -2.1724665
C - D     -3.440 0.2136          -8.427534  1.5475335
C - E     -3.150 0.1258          -7.262208  0.9622083
D - E      0.290 0.8845          -3.822208  4.4022083

Prueba de Least significant difference

agricolae::LSD.test(modelo.dca, trt = "trt", 
                       alpha = 0.05, group = TRUE, 
                       main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

LSD t Test for rdt 

Mean Square Error:  9.715762 

trt,  means and individual ( 95 %) CI

     rdt      std r      LCL      UCL   Min   Max
A 47.134 2.840129 5 44.22623 50.04177 42.26 49.43
B 51.718 5.324328 5 48.81023 54.62577 44.41 57.31
C 55.728 2.229747 5 52.82023 58.63577 53.72 59.45
D 59.168 2.065798 5 56.26023 62.07577 55.87 60.89
E 58.878 1.710181 5 55.97023 61.78577 55.87 60.17

Alpha: 0.05 ; DF Error: 20
Critical Value of t: 2.085963 

least Significant Difference: 4.112208 

Treatments with the same letter are not significantly different.

     rdt groups
D 59.168      a
E 58.878      a
C 55.728     ab
B 51.718      b
A 47.134      c
agricolae::LSD.test(modelo.dca, trt = "trt", 
                       alpha = 0.05, group = FALSE, 
                       main = NULL, console = TRUE)

Study: modelo.dca ~ "trt"

LSD t Test for rdt 

Mean Square Error:  9.715762 

trt,  means and individual ( 95 %) CI

     rdt      std r      LCL      UCL   Min   Max
A 47.134 2.840129 5 44.22623 50.04177 42.26 49.43
B 51.718 5.324328 5 48.81023 54.62577 44.41 57.31
C 55.728 2.229747 5 52.82023 58.63577 53.72 59.45
D 59.168 2.065798 5 56.26023 62.07577 55.87 60.89
E 58.878 1.710181 5 55.97023 61.78577 55.87 60.17

Alpha: 0.05 ; DF Error: 20
Critical Value of t: 2.085963 

Comparison between treatments means

      difference pvalue signif.        LCL        UCL
A - B     -4.584 0.0307       *  -8.696208 -0.4717915
A - C     -8.594 0.0003     *** -12.706208 -4.4817915
A - D    -12.034 0.0000     *** -16.146208 -7.9217915
A - E    -11.744 0.0000     *** -15.856208 -7.6317915
B - C     -4.010 0.0554       .  -8.122208  0.1022085
B - D     -7.450 0.0012      ** -11.562208 -3.3377915
B - E     -7.160 0.0017      ** -11.272208 -3.0477915
C - D     -3.440 0.0963       .  -7.552208  0.6722085
C - E     -3.150 0.1258          -7.262208  0.9622085
D - E      0.290 0.8845          -3.822208  4.4022085